Skip to content

arrowio: Fix false positives in type recursion detection#6883

Open
mattnibs wants to merge 1 commit into
mainfrom
arrowio-recursive-types
Open

arrowio: Fix false positives in type recursion detection#6883
mattnibs wants to merge 1 commit into
mainfrom
arrowio-recursive-types

Conversation

@mattnibs
Copy link
Copy Markdown
Collaborator

@mattnibs mattnibs commented May 1, 2026

Closes #6866

@philrz philrz requested a review from a team May 4, 2026 22:47
@mccanne
Copy link
Copy Markdown
Collaborator

mccanne commented May 19, 2026

I think this is the right fix...

diff --git a/sio/arrowio/writer.go b/sio/arrowio/writer.go
index ed0017a54..baa01e9d7 100644
--- a/sio/arrowio/writer.go
+++ b/sio/arrowio/writer.go
@@ -5,7 +5,6 @@ import (
        "errors"
        "fmt"
        "io"
-       "maps"
        "math"
        "slices"
        "strconv"
@@ -533,10 +532,12 @@ func isRecursive(typ super.Type, seen map[string]struct{}) bool {
                        return true
                }
                seen[typ.Name] = struct{}{}
-               return isRecursive(typ.Type, seen)
+               is := isRecursive(typ.Type, seen)
+               delete(seen, typ.Name)
+               return is
        case *super.TypeRecord:
                for _, f := range typ.Fields {
-                       if isRecursive(f.Type, maps.Clone(seen)) {
+                       if isRecursive(f.Type, seen) {
                                return true
                        }
                }
@@ -545,7 +546,7 @@ func isRecursive(typ super.Type, seen map[string]struct{}) bool {
        case *super.TypeSet:
                return isRecursive(typ.Type, seen)
        case *super.TypeMap:
-               return isRecursive(typ.KeyType, maps.Clone(seen)) || isRecursive(typ.ValType, maps.Clone(seen))
+               return isRecursive(typ.KeyType, seen) || isRecursive(typ.ValType, seen)
        case *super.TypeUnion:
                for _, t := range typ.Types {
                        if isRecursive(t, seen) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't output in Arrow format when data contains named type

2 participants